package com.example.wanglong.myoneapplication.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.TextView;

import com.example.wanglong.myoneapplication.entity.VisaOrderEntity;

import com.example.wanglong.myoneapplication.R;
import java.util.List;

/**
 * Created by wang.long on 2016/4/20.
 */
public class VisaOrderAdapter extends ArrayAdapter<VisaOrderEntity> {


    private int oid;

    public VisaOrderAdapter(Context context,int txtViewid,List<VisaOrderEntity> objects){
        super(context,txtViewid,objects);
        oid=txtViewid;
    }

    @Override
    public View getView(int position,View convertView,ViewGroup parent){
        VisaOrderEntity visaOrderEntity=getItem(position);
        View view;
        if(convertView==null){
            view= LayoutInflater.from(getContext()).inflate(oid,null);
        } else {
            view=convertView;
        }
        TextView title=(TextView) view.findViewById(R.id.title);
        TextView time=(TextView) view.findViewById(R.id.time);
        TextView price=(TextView) view.findViewById(R.id.price);
        Button ordertype=(Button) view.findViewById(R.id.ordertype);
        TextView orderpricetype=(TextView) view.findViewById(R.id.orderpricetype);

        title.setText(visaOrderEntity.getTitle());
        time.setText(visaOrderEntity.getTime());
        price.setText(visaOrderEntity.getPrice());
        ordertype.setText(visaOrderEntity.getOrdertype());
        orderpricetype.setText(visaOrderEntity.getOrderpricetype());

        return  view;

    }



}





